home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / AIncludes / Multiprocessing.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  8.2 KB  |  364 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Multiprocessing.a
  3. ;
  4. ;    Contains:    Multiprocessing interfaces
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1996-1998 by Apple Computer, Inc. and © 1995-1997 DayStar Digital, Inc.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__MULTIPROCESSING__') = 'UNDEFINED' THEN
  18. __MULTIPROCESSING__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.     IF &TYPE('__CODEFRAGMENTS__') = 'UNDEFINED' THEN
  24.     include 'CodeFragments.a'
  25.     ENDIF
  26.  
  27.     IF TARGET_CPU_PPC THEN
  28.  
  29. MPLibrary_MajorVersion            EQU        1
  30. MPLibrary_MinorVersion            EQU        4
  31. MPLibrary_Release                EQU        1
  32. MPLibrary_DevelopmentRevision    EQU        2
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. ; typedef UInt32                         MPSemaphoreCount
  42.  
  43. ; typedef UInt32                         MPTaskOptions
  44.  
  45.  
  46. kDurationImmediate                EQU        0
  47. kDurationForever                EQU        $7FFFFFFF
  48.  
  49. kMPNoID                            EQU        0
  50.  
  51. ;
  52. ; extern UInt32 MPProcessors(void )
  53. ;
  54.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  55.         IMPORT_CFM_FUNCTION MPProcessors
  56.     ENDIF
  57.  
  58. ;
  59. ; extern OSStatus MPCreateTask(TaskProc entryPoint, void *parameter, ByteCount stackSize, MPQueueID notifyQueue, void *terminationParameter1, void *terminationParameter2, MPTaskOptions options, MPTaskID *task)
  60. ;
  61.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  62.         IMPORT_CFM_FUNCTION MPCreateTask
  63.     ENDIF
  64.  
  65.  
  66. ;
  67. ; extern OSStatus MPTerminateTask(MPTaskID task, OSStatus terminationStatus)
  68. ;
  69.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  70.         IMPORT_CFM_FUNCTION MPTerminateTask
  71.     ENDIF
  72.  
  73.  
  74. ;
  75. ; extern void MPExit(OSStatus status)
  76. ;
  77.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  78.         IMPORT_CFM_FUNCTION MPExit
  79.     ENDIF
  80.  
  81.  
  82. ;
  83. ; extern MPTaskID MPCurrentTaskID(void )
  84. ;
  85.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  86.         IMPORT_CFM_FUNCTION MPCurrentTaskID
  87.     ENDIF
  88.  
  89.  
  90. ;
  91. ; extern void MPYield(void )
  92. ;
  93.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  94.         IMPORT_CFM_FUNCTION MPYield
  95.     ENDIF
  96.  
  97.  
  98. ;
  99. ; extern OSStatus MPCreateQueue(MPQueueID *queue)
  100. ;
  101.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  102.         IMPORT_CFM_FUNCTION MPCreateQueue
  103.     ENDIF
  104.  
  105.  
  106. ;
  107. ; extern OSStatus MPDeleteQueue(MPQueueID queue)
  108. ;
  109.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  110.         IMPORT_CFM_FUNCTION MPDeleteQueue
  111.     ENDIF
  112.  
  113.  
  114. ;
  115. ; extern OSStatus MPNotifyQueue(MPQueueID queue, void *param1, void *param2, void *param3)
  116. ;
  117.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  118.         IMPORT_CFM_FUNCTION MPNotifyQueue
  119.     ENDIF
  120.  
  121.  
  122. ;
  123. ; extern OSStatus MPWaitOnQueue(MPQueueID queue, void **param1, void **param2, void **param3, Duration timeout)
  124. ;
  125.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  126.         IMPORT_CFM_FUNCTION MPWaitOnQueue
  127.     ENDIF
  128.  
  129.  
  130. ;
  131. ; extern OSStatus MPCreateSemaphore(MPSemaphoreCount maximumValue, MPSemaphoreCount initialValue, MPSemaphoreID *semaphore)
  132. ;
  133.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  134.         IMPORT_CFM_FUNCTION MPCreateSemaphore
  135.     ENDIF
  136.  
  137.  
  138.  
  139. ;
  140. ; extern OSStatus MPWaitOnSemaphore(MPSemaphoreID semaphore, Duration timeout)
  141. ;
  142.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  143.         IMPORT_CFM_FUNCTION MPWaitOnSemaphore
  144.     ENDIF
  145.  
  146.  
  147. ;
  148. ; extern OSStatus MPSignalSemaphore(MPSemaphoreID semaphore)
  149. ;
  150.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  151.         IMPORT_CFM_FUNCTION MPSignalSemaphore
  152.     ENDIF
  153.  
  154.  
  155. ;
  156. ; extern OSStatus MPDeleteSemaphore(MPSemaphoreID semaphore)
  157. ;
  158.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  159.         IMPORT_CFM_FUNCTION MPDeleteSemaphore
  160.     ENDIF
  161.  
  162.  
  163. ;
  164. ; extern OSStatus MPCreateCriticalRegion(MPCriticalRegionID *criticalRegion)
  165. ;
  166.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  167.         IMPORT_CFM_FUNCTION MPCreateCriticalRegion
  168.     ENDIF
  169.  
  170.  
  171. ;
  172. ; extern OSStatus MPEnterCriticalRegion(MPCriticalRegionID criticalRegion, Duration timeout)
  173. ;
  174.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  175.         IMPORT_CFM_FUNCTION MPEnterCriticalRegion
  176.     ENDIF
  177.  
  178.  
  179. ;
  180. ; extern OSStatus MPExitCriticalRegion(MPCriticalRegionID criticalRegion)
  181. ;
  182.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  183.         IMPORT_CFM_FUNCTION MPExitCriticalRegion
  184.     ENDIF
  185.  
  186.  
  187. ;
  188. ; extern OSStatus MPDeleteCriticalRegion(MPCriticalRegionID criticalRegion)
  189. ;
  190.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  191.         IMPORT_CFM_FUNCTION MPDeleteCriticalRegion
  192.     ENDIF
  193.  
  194.  
  195. ;
  196. ; extern LogicalAddress MPAllocate(ByteCount size)
  197. ;
  198.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  199.         IMPORT_CFM_FUNCTION MPAllocate
  200.     ENDIF
  201.  
  202. ;
  203. ; extern void MPFree(LogicalAddress object)
  204. ;
  205.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  206.         IMPORT_CFM_FUNCTION MPFree
  207.     ENDIF
  208.  
  209.  
  210. ;
  211. ; extern void MPBlockCopy(LogicalAddress sourcePtr, LogicalAddress destPtr, ByteCount blockSize)
  212. ;
  213.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  214.         IMPORT_CFM_FUNCTION MPBlockCopy
  215.     ENDIF
  216.  
  217.  
  218. ; **************************************************************************
  219. ; *
  220. ; *    MPTaskIsToolboxSafe() and MPRPC() were functions added by DayStar. 
  221. ; *    The 1.4 MPLibrary exports the names with an underscore prefix. 
  222. ; *    To work around this, #defines have been added to automatically
  223. ; *    add the underscore.
  224. ; *
  225.  
  226. ;  
  227. ;    MPTaskIsToolboxSafe() allows routines which are otherwise unaware that 
  228. ;    they are being called from an MP task to check to see if it is permissible
  229. ;    to make a call to the Macintosh toolbox.  (It is okay to make toolbox 
  230. ;    calls only if the routine is not being called from an MP task).
  231. ;
  232.  
  233. ;
  234. ; extern Boolean MPTaskIsToolboxSafe(MPTaskID task)
  235. ;
  236.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  237.         IMPORT_CFM_FUNCTION MPTaskIsToolboxSafe
  238.     ENDIF
  239.  
  240. ;    MPRPC() calls its MPRemoteProcedure parameter in the application's main 
  241. ;    thread when the app next calls WaitNextEvent, EventAvail, SystemTask, 
  242. ;    MPYield, MPWaitOnQueue, MPWaitOnSemaphore, or MPEnterCriticalRegion. The  
  243. ;    return value of the MPRemoteProcedure is returned as the result of MPRPC.  
  244. ;    The MPRemoteProcedure function can call any toolbox function except  
  245. ;    SystemTask (or anything that calls it).
  246. ;
  247.  
  248. ;
  249. ; extern void *MPRPC(MPRemoteProcedure theProc, void *parameter)
  250. ;
  251.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  252.         IMPORT_CFM_FUNCTION MPRPC
  253.     ENDIF
  254.  
  255.  
  256.  
  257. ; **************************************************************************
  258. ; *
  259. ; *    The following routines were added by DayStar for debugging purposes.
  260. ; *    You should not use these in shipping products.  You can tell which
  261. ; *    functions are for debugging only because they begin with an underscore
  262. ; *
  263.  
  264. ;
  265. ; extern Boolean _MPIsFullyInitialized(void )
  266. ;
  267.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  268.         IMPORT_CFM_FUNCTION _MPIsFullyInitialized
  269.     ENDIF
  270.  
  271.  
  272. ;    MPAllocateSys() does the same thing as MPAllocate() except the memory
  273. ;    is allocated from the system heap.
  274. ;
  275.  
  276. ;
  277. ; extern LogicalAddress _MPAllocateSys(ByteCount size)
  278. ;
  279.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  280.         IMPORT_CFM_FUNCTION _MPAllocateSys
  281.     ENDIF
  282.  
  283.  
  284. ;
  285. ; extern Boolean _MPLibraryIsCompatible(const char *versionCString, UInt32 major, UInt32 minor, UInt32 release, UInt32 revision)
  286. ;
  287.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  288.         IMPORT_CFM_FUNCTION _MPLibraryIsCompatible
  289.     ENDIF
  290.  
  291. ;    MPLibraryVersion() retrieves the hardcoded version information built into
  292. ;    the currently active Multiprocessing API Library.
  293. ;
  294.  
  295. ;
  296. ; extern void _MPLibraryVersion(const char **versionCString, UInt32 *major, UInt32 *minor, UInt32 *release, UInt32 *revision)
  297. ;
  298.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  299.         IMPORT_CFM_FUNCTION _MPLibraryVersion
  300.     ENDIF
  301.  
  302. ;
  303. ; extern void _MPInitializePrintf(MPPrintfHandler pfn)
  304. ;
  305.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  306.         IMPORT_CFM_FUNCTION _MPInitializePrintf
  307.     ENDIF
  308.  
  309. ;
  310. ; extern void _MPPrintf(const char *format, ...)
  311. ;
  312.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  313.         IMPORT_CFM_FUNCTION _MPPrintf
  314.     ENDIF
  315.  
  316.  
  317. ;     MPDebugStr() works just like DebugStr() except that it is safe
  318. ;    to call it from an MP task.
  319. ;
  320.  
  321. ;
  322. ; extern void _MPDebugStr(ConstStr255Param msg)
  323. ;
  324.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  325.         IMPORT_CFM_FUNCTION _MPDebugStr
  326.     ENDIF
  327.  
  328. ;
  329. ;    MPStatusPString() and MPStatusCString() provide a way to translate an OSStatus
  330. ;    value returned from one of the MP API calls into either a Pascal string or a
  331. ;    C string.  Thus, if an MPLibrary function returns an error then the application
  332. ;    (not a task) could use the following:
  333. ;
  334. ;    status = MPxxx( function_params );
  335. ;    DebugStr( MPStatusPString( status ) );
  336. ;    
  337. ;
  338.  
  339. ;
  340. ; extern StringPtr _MPStatusPString(OSStatus status)
  341. ;
  342.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  343.         IMPORT_CFM_FUNCTION _MPStatusPString
  344.     ENDIF
  345.  
  346. ;
  347. ; extern const char *_MPStatusCString(OSStatus status)
  348. ;
  349.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  350.         IMPORT_CFM_FUNCTION _MPStatusCString
  351.     ENDIF
  352.  
  353.  
  354.     ENDIF    ; TARGET_CPU_PPC
  355.     ENDIF ; __MULTIPROCESSING__ 
  356.  
  357.